#include<iostream>
using namespace std;
const int N = 1e5 + 10;
int tree[N];
int n;
int lowbit(int x)
{
	return x & (-x);
}
void add(int x, int v)
{
	for (int i = x; i <= N; i += lowbit(i)) {
		tree[i] += v;
	}
}
int query(int x)
{
	int ans = 0;
	for (int i = x; i; i -= lowbit(i)) {
		ans += tree[i];
	}
	return ans;
}
int main()
{
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		add(x, 1);
		ans += i - query(x);
	}
	cout << ans << endl;
	return 0;
}